﻿<UserControl x:Class="ViewDashboardZone"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:OMANE.Modules.Dashboarding"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Name="Zone" >


    <UserControl.ContextMenu>
        <ContextMenu>
            <MenuItem Header="Copier" Name="CopierContextMenuItem"  />
            <MenuItem Header="Couper" />
            <!--<MenuItem Header="Coller" />-->
            <Separator />
            <MenuItem Header="Modifier" Name="ModifierContextMenuItem" />
            <MenuItem Header="Annoter"   />
            <MenuItem Header="Exporter" />
            <Separator />
            <MenuItem Header="Supprimer" />
        </ContextMenu>
    </UserControl.ContextMenu>
    <Grid Name="root">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition  />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition  />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>


        <Thumb Grid.Column="0" Grid.Row="0" Style="{DynamicResource ThumbSizeStyle}" />
        <Thumb Width="3" Name="lcthumb" Grid.Column="0" Grid.Row="1" Style="{DynamicResource ThumbSizeStyle}"  Cursor="SizeWE" DragDelta="Thumb_DragDelta"  DragStarted="Thumb_DragStarted" DragCompleted="Thumb_DragCompleted"/>
        <Thumb Grid.Column="0" Grid.Row="2" Style="{DynamicResource ThumbSizeStyle}" />
        <Thumb Height="3" Name="ctthumb" Grid.Column="1" Grid.Row="0" Style="{DynamicResource ThumbSizeStyle}"  Cursor="SizeNS" DragDelta="Thumb_DragDelta"  DragStarted="Thumb_DragStarted" DragCompleted="Thumb_DragCompleted"/>
        <Thumb Height="3" Name="cbthumb" Grid.Column="1" Grid.Row="2" Style="{DynamicResource ThumbSizeStyle}" Cursor="SizeNS" DragDelta="Thumb_DragDelta"  DragStarted="Thumb_DragStarted" DragCompleted="Thumb_DragCompleted"/>
        <Thumb Grid.Column="2" Grid.Row="0" Style="{DynamicResource ThumbSizeStyle}"/>
        <Thumb Width="3" Name="rcthumb" Grid.Column="2" Grid.Row="1" Style="{DynamicResource ThumbSizeStyle}"  Cursor="SizeWE" DragDelta="Thumb_DragDelta" DragStarted="Thumb_DragStarted" DragCompleted="Thumb_DragCompleted"/>
        <Thumb Grid.Column="2" Grid.Row="2" Style="{DynamicResource ThumbSizeStyle}"/>


        <Grid Grid.Column="1" Grid.Row="1" Name="DetailGrid" >
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition  />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition  />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <Border Background="{Binding ElementName=Zone, Path=ZoneBackground}" 
                    BorderBrush="{Binding ElementName=Zone, Path=ZoneBorderBrush}"
                    BorderThickness="{Binding ElementName=Zone, Path=ZoneBorderThickness}" 
                    CornerRadius="{Binding ElementName=Zone, Path=ZoneCornerRadius}"
                    Grid.Row="1" Grid.Column="1"  >
                <ContentPresenter Content="{Binding Visual}" />
            </Border>

            <!--Background="{Binding ElementName=Zone, Path=ZoneBackground}"-->
            <!--Style="{Binding ElementName=Zone, Path=TitleXamlStyle}"-->
            <Thumb 
                
                local:Extender.CornerRadius="0" 
                local:Extender.TextWrapping="NoWrap" 
                local:Extender.TextTrimming="None"   
                RenderTransformOrigin="0.5,0.5"
                Name="ccthumb" 
                Grid.ColumnSpan="3"
                DataContext="{Binding ElementName=Zone, Path=Title}"
                MouseDoubleClick="Thumb_MouseDoubleClick" 
                Cursor="ScrollAll" DragDelta="Thumb_DragDelta"  
                DragStarted="Thumb_DragStarted"
                DragCompleted="Thumb_DragCompleted">
                <Thumb.Template>
                    <ControlTemplate TargetType="Thumb">
                        <Border
                            Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            CornerRadius="{TemplateBinding local:Extender.CornerRadius}">

                            <TextBlock Text="{Binding}" 
                                  Name="TitleTextBlock" 
                                  Margin="{TemplateBinding Padding}" 
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                  TextWrapping="{TemplateBinding local:Extender.TextWrapping}" 
                                  TextTrimming="{TemplateBinding local:Extender.TextTrimming}"/>
                        </Border>
                    </ControlTemplate>
                </Thumb.Template>

                <Thumb.LayoutTransform>
                    <RotateTransform Angle="0" />
                </Thumb.LayoutTransform>
            </Thumb>

        </Grid>

        <TextBlock Background="Black" Foreground="White"  HorizontalAlignment="Center" Style="{DynamicResource LayoutTextBlockStyle}" VerticalAlignment="Bottom" Grid.Row="1" Grid.Column="1" Text="{Binding ElementName=Zone, Path=Margin.Bottom, StringFormat=N0}" />
        <TextBlock Background="Black" Foreground="White" HorizontalAlignment="Center" Style="{DynamicResource LayoutTextBlockStyle}" VerticalAlignment="Top" Grid.Row="1" Grid.Column="1" Text="{Binding ElementName=Zone, Path=Margin.Top, StringFormat=N0}" />
        <TextBlock Background="Black" Foreground="White"  VerticalAlignment="Center" Style="{DynamicResource LayoutTextBlockStyle}" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="1" Text="{Binding ElementName=Zone, Path=Margin.Left, StringFormat=N0}" />
        <TextBlock Background="Black" Foreground="White" VerticalAlignment="Center" Style="{DynamicResource LayoutTextBlockStyle}" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="1" Text="{Binding ElementName=Zone, Path=Margin.Right, StringFormat=N0}" />
        <TextBlock Background="Black" Foreground="White" VerticalAlignment="Center" Style="{DynamicResource LayoutTextBlockStyle}" HorizontalAlignment="Center" Grid.Row="1" Grid.Column="1" >
            <TextBlock.Inlines>
                <Run Text="{Binding ElementName=Zone, Path=Width, StringFormat=N0, Converter={x:Static local:NaNConverter.Instance}}" />
                <Run Text=";" />
                <Run Text="{Binding ElementName=Zone, Path=Height, StringFormat=N0, Converter={x:Static local:NaNConverter.Instance}}"/>
            </TextBlock.Inlines>
        </TextBlock>

    </Grid>
</UserControl>
